// pages/share/index/index.js
const app = getApp()
const db = wx.cloud.database()
const _ = db.command

Page({

    /**
     * 页面的初始数据
     */
    data: {
        anmdata:[],
        showOk:false
    },

    swichShowOk(){
        this.setData({
            showOk: true
        })
    },

    getData(){
        let that = this
        wx.cloud.database().collection('share').orderBy("createTime","desc").get({
            success: res =>{
                that.setData({
                    anmdata: res.data
                })
            }
        })
    },

    toInfo: function(e){
        let index = e.currentTarget.dataset.index;
        app.globalData.shareInfo = this.data.anmdata[index]
        wx.navigateTo({
          url: '../info/index',
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.getData()
    },

})